#include "stdio.h"
#include "stdint.h"
#include "string.h"
#include "DevicesFlash.h"


/* 写入长度需要是 2的整数倍 */
int8_t cFlashWriteDatas(uint32_t uiAddress, const void *pvBuff, int32_t iLength)
{
    uint16_t *pusDataAddress = (uint16_t *)pvBuff;
    int8_t cError = 0, cCnt = 0;

    return cError;
}

int8_t cFlashReadDatas(uint32_t uiAddress, void *pvBuff, int32_t iLength)
{
    if((iLength < 1) || ((uiAddress + iLength) > FLASH_USER_MAX_ADDR))
    {
        printf("cFlashReadDatas uiAddress: %08X iLength: %d >= FLASH_USER_MAX_ADDR.\r\n", (int)uiAddress, (int)iLength);
        return 1;
    }

    /* Read Flash */
    memcpy(pvBuff, (uint8_t *)uiAddress, iLength);

    return 0;
}
